package com.ruoyi.report.service.impl;

import com.ruoyi.report.domain.HanZaiEmail;
import com.ruoyi.report.domain.HanZaiEmailUserName;
import com.ruoyi.report.mapper.HanZaiEmailMapper;
import com.ruoyi.report.service.HanZaiEmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: 憨憨爱崽崽
 * Name: EmailServiceImpl
 * Date: 2022/3/29
 * Time: 13:06
 **/
@Service
public class HanZaiEmailServiceImpl implements HanZaiEmailService {
    @Autowired
    private HanZaiEmailMapper emailMapper;

    @Override
    public List<HanZaiEmail> selectEmailList(HanZaiEmail email) {
        return emailMapper.selectEmailList(email);
    }

    @Override
    public String selectUserName(Integer userId) {
        return emailMapper.selectUserName(userId);
    }

    @Override
    public List<HanZaiEmailUserName> selectUserNameList(Integer userId) {
        return emailMapper.selectUserNameList(userId);
    }

    @Override
    public int saveEmail(HanZaiEmail email) {
        return emailMapper.saveEmail(email);
    }

    @Override
    public int readEmail(Integer emailId) {
        HanZaiEmail email = new HanZaiEmail();
        email.setEmailId(emailId);
        email.setIsRead("已读");
        return emailMapper.updateEmail(email);
    }

    @Override
    public int deleteEmail(Integer emailId) {
        return emailMapper.deleteEmail(emailId);
    }

}
